#include "engine.h"
#include "tick_signal.h"
#include "data_types.hpp"


void tick_signal::on_init(lt::subscriber& suber)
{
	suber.regist_tick_receiver(_code,this);
};

void tick_signal::on_destory(lt::unsubscriber& unsuber)
{
	unsuber.unregist_tick_receiver(_code,this);
};

void tick_signal::on_tick(const tick_info& tick)
{
	if(tick.price <= tick.buy_price())
	{
		trigger(tick.id, lt::ACT_BULL);
	}
	else if(tick.price >= tick.sell_price())
	{
		trigger(tick.id, lt::ACT_BEAR);
	}
	
}

